﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace WuxiWTO.Web.UserControl
{
    public partial class userInfo : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user_name"] == null && Request.Cookies["wtouser"] == null)
            {
                Response.Redirect(Server.HtmlEncode("login.aspx?ret=userCenter.aspx"));
            }
        }

        protected void Page_PreRender(object sender,EventArgs e)
        {
            BulidLeftTree();
        }

        private void BulidLeftTree()
        {
            StringBuilder sbMenu = new StringBuilder();
            //个人用户
            if (Session["user_type"].ToString() == "I")
            {
                sbMenu.Append("<li><a href='myTrainingHistory.aspx'>");
                sbMenu.Append("我的培训历史");
                sbMenu.Append("</a></li>");
                sbMenu.Append("<li><a href='joinTraining.aspx'>");
                sbMenu.Append("我要参加培训");
                sbMenu.Append("</a></li>");
            }
            else
            {
                sbMenu.Append("<li><a href='enterpriseComplain.aspx'>");
                sbMenu.Append("我的咨询投诉历史");
                sbMenu.Append("</a></li>");
                sbMenu.Append("<li><a href='newComplain.aspx'>");
                sbMenu.Append("我要咨询投诉");
                sbMenu.Append("</a></li>");
            }
            this.litUserLinks.Text = sbMenu.ToString();
        }
    }
}